package com.example.forestmanagement;

import android.os.Bundle;
import android.widget.ImageButton;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.tabs.TabLayout;

public class ForestDetailActivity extends AppCompatActivity {
    private TabLayout tabLayout;
    private ImageButton btnBack;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forest_detail);

        tabLayout = findViewById(R.id.tab_layout);
        btnBack = findViewById(R.id.btn_back);

        setupViews();
        loadForestData();
    }

    private void setupViews() {
        btnBack.setOnClickListener(v -> finish());

        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                int position = tab.getPosition();
                if (position == 0) {
                    showBasicInfo();
                } else if (position == 1) {
                    showAerialPhotos();
                } else if (position == 2) {
                    showWorkers();
                } else if (position == 3) {
                    showHistory();
                }
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {}

            @Override
            public void onTabReselected(TabLayout.Tab tab) {}
        });
    }

    private void loadForestData() {
        String forestId = getIntent().getStringExtra("forest_id");
        // TODO: 根据林班ID加载数据
    }

    private void showBasicInfo() {
        // TODO: 显示基础信息
    }

    private void showAerialPhotos() {
        // TODO: 显示航拍图
    }

    private void showWorkers() {
        // TODO: 显示作业人员
    }

    private void showHistory() {
        // TODO: 显示历史记录
    }
} 